package com.example.cardgame

import java.util.Random

class Deck2() {
    private val cards = mutableListOf<Card2>()
    private val r = Random()
    init {
        for (suit in Card2.validSuits) {
            for (rank in Card2.rankStrings) {
                val card = Card2(suit=suit,rank=rank)
                cards.add(card)
            }
        }
    }

    fun drawRandomCard(): Card2? {
        var randomCard: Card2? = null
        if (cards.size > 0) {
            randomCard = cards.removeAt(r.nextInt(cards.size))
        }
        return randomCard
    }
}